#ifndef F_CAIntPlannerC_h
#define F_CAIntPlannerC_h

// ***********************************************************************

// class EDROOMTopContext

// ***********************************************************************



class EDROOMTopContext {

protected:

enum EDROOMCAIntPlannerSignal { EDROOMSignalTimeout, EDROOMSignalDestroy, SToListening, SToStandBy, SKeepOnComm, STMToTransmit, SToComm, SInStandBy, STMTransmited, SCommConfigured, STCReceived, SCommInterrupted };


	friend class CAIntPlanner;

	CAIntPlanner &EDROOMcomponent;

	CEDROOMMessage * &Msg;

	CEDROOMMessage * &MsgBack;

	//Ports

	CEDROOMInterface & SSICtrl;
	CEDROOMInterface & EmuPlannerSGIControl;

	enum edroomStateId{I, Ready};

	enum IdTrans{Init,  EDROOMMEMORIA };

	//Constantes



	//Variables



	//Pool

	class CEDROOMPOOLCDCommConfig:public CEDROOMProtectedMemoryPool {
		public:
		CEDROOMPOOLCDCommConfig(TEDROOMUInt32 elemCount,CDCommConfig *pMem, TEDROOMBool *pMarks);
		CDCommConfig	* AllocData();
	};
	CEDROOMPOOLCDCommConfig	& CEDROOMPoolCDCommConfig;


	// CONSTRUCTORES

	EDROOMTopContext (CAIntPlanner &act, CEDROOMPOOLCDCommConfig & EDROOMpPoolCDCommConfig );

	EDROOMTopContext ( EDROOMTopContext &contex );

public:

	bool EDROOMSearchContextTrans(TEDROOMTransId &edroomCurrentTrans);

	void EDROOMNuevoMens () { EDROOMcomponent.EDROOMNewMsg(); }

	// Funciones Definidas por el usuario

	void	FInit();

	void	FSendKeepOnComm();

	void	FSendToSgi();

	void	FTimerEmuPlanner();

};

// ***********************************************************************

// class EDROOMTopState

// ***********************************************************************



class EDROOMTopState : public EDROOMTopContext {

protected:



	EDROOMTopContext::edroomStateId edroomCurrentState;

	EDROOMTopContext::edroomStateId edroomNextState;

	//Variables



	//Pools

	CEDROOMPOOLCDCommConfig	CEDROOMPoolCDCommConfig;


public:

	// CONSTRUCTOR

	EDROOMTopState (CAIntPlanner &act, CEDROOMMemory *pEDROOMMemory  );


	// EDROOMBehaviour**********************************************

	void EDROOMBehaviour();

	// Inicio**********************************************

	void EDROOMInicio();

	// ***********************************************************************

	// SubEstado Inicial 

	// ***********************************************************************



	TEDROOMTransId EDROOMIllegada();

	// ***********************************************************************

	// SubEstado Hoja Ready

	// ***********************************************************************



	TEDROOMTransId EDROOMReadyllegada();

};


#endif
